#include <stdio.h>

#define MAXLENGTH 1000

void reverse(char s[], int n);
int get_line(char s[]);

int main()
{
    int len;
    char line[MAXLENGTH];

    len = 0;
    while ((len = get_line(line)) > 0)
    {
        reverse(line, len);
        printf("%s\n", line);
    }

    return 0;
}

void reverse(char s[], int n)
{
    int i, j;
    char temp;

    i = 0;
    j = n - 1;
    while (i < j)
    {
        temp = s[i];
        s[i] = s[j];
        s[j] = temp;

        i++;
        j--;
    }
}

int get_line(char s[])
{
    int c, i;

    for (i = 0; i < MAXLENGTH - 1 && (c = getchar()) != EOF && c != '\n'; ++i)
    {
        s[i] = c;
    }
    s[i] = '\0';
    return i;
}